package com.highcom;

import com.highcom.config.SpringConfig;
import com.highcom.domain.Account;
import com.highcom.service.AccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class Main {
    public static void main(String[] args) {
        ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        AccountService accountService = (AccountService) ctx.getBean("accountService");

       // List<Account> accounts = accountService.findAll();
       // System.out.println("accounts = " + accounts);

        //List<Account> accounts = accountService.findAll();
        //System.out.println("accounts = " + accounts);
        //Account byId = (Account) accountService.findById(10);
        //System.out.println("byId = " + byId);



         accountService.delete(2);



         Account account = new Account();
         account.setName("wula2");
         account.setMoney(5011.0);
        account.setId(13);
       //  accountService.save(account);
        accountService.update(account);
    }
}